home *** CD-ROM | disk | FTP | other *** search
/ PC Online 2000 October / Pc Online Ekim 2000.iso / prog / mail / 08 / setup.exe / data1.cab / Migration_Files / Migstub.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-09  |  13.5 KB  |  451 lines

  1. #include "migstub.h"
  2.  
  3. //-----------------------------------------------------------------------------
  4. //  The following code was written by Blueprint Software Works, DO NOT CHANGE IT!!!
  5. //  
  6. //  Initialization And UI Code...
  7. //-----------------------------------------------------------------------------
  8.  
  9. pMigAcct MigLibAllocAcct(void){
  10.     pMigAcct acct;
  11.  
  12.     acct=(pMigAcct)malloc(sizeof(MigAcct));
  13.  
  14.     acct->acctname=strdup("");
  15.     acct->fromemail=strdup("");
  16.     acct->fromreal=strdup("");
  17.     acct->replyemail=strdup("");
  18.     acct->replyreal=strdup("");
  19.  
  20.     acct->recvsmtp=0;
  21.     acct->poprecvserv=strdup("");
  22.     acct->poprecvport=110;
  23.     acct->poprecvid=strdup("");
  24.     acct->poprecvpass=strdup("");
  25.     acct->ignore=0;
  26.     acct->leave=0;
  27.     acct->size=30;
  28.     acct->useservview=0;    
  29.     acct->smtppath=strdup("");
  30.     acct->poll=0;
  31.     acct->interval=130;
  32.  
  33.     acct->sendpop=0;
  34.     acct->smtpsendserv=strdup("");
  35.     acct->smtpsendport=25;
  36.     acct->popsendserv=strdup("");
  37.     acct->popsendport=110;
  38.     acct->popsendid=strdup("");
  39.     acct->popsendpass=strdup("");
  40.     acct->saveout=1;    
  41.     acct->wraptype=2;
  42.     acct->wraplen=72;
  43.     acct->defatttype=1;
  44.     acct->safterf=0;
  45.     acct->html=1;
  46.  
  47.     acct->viewfull=0;
  48.     acct->noquote=0;
  49.     acct->quotepre=strdup(">");
  50.     acct->sysbeep=1;
  51.     acct->wav=0;
  52.     acct->wavfile=strdup("pmmail.wav");
  53.     acct->passprot=0;
  54.     acct->acctpass=strdup("");
  55.     acct->startopen=1;
  56.     acct->startsend=0;
  57.     acct->startfetch=0;
  58.     acct->emptytrash=0;
  59.     acct->truedel=0;
  60.  
  61.     acct->spellalways=0;
  62.     acct->skipcaps=0;
  63.     acct->skipquote=0;
  64.     acct->skipnum=0;
  65.  
  66.     acct->askcloprog=1;
  67.     acct->askclocomp=1;
  68.     acct->askrepatt=1;
  69.     acct->promdelmes=1;
  70.     acct->promdelfold=1;
  71.     acct->promdelacct=1;
  72.  
  73.     acct->useext=0;
  74.     acct->editor=strdup("notepad.exe");
  75.     acct->args=strdup("%s");
  76.     acct->type=0;
  77.     acct->editcomp=1;
  78.     acct->editread=0;
  79.  
  80.     acct->hookrecv=strdup("");
  81.     acct->hooksend=strdup("");
  82.     acct->sendexit=0;
  83.     acct->recvexit=0;
  84.     acct->sendbg=1;
  85.     acct->recvbg=1;
  86.     acct->hookcustf=strdup("");
  87.     acct->hookcusts=strdup("");
  88.     acct->custf=0;
  89.     acct->custs=0;
  90.     acct->custfbg=1;
  91.     acct->custsbg=1;
  92.  
  93.     acct->begdial=0;
  94.     acct->enddial=0;
  95.     acct->begdialbg=1;
  96.     acct->enddialbg=1;
  97.     acct->hookbegd=strdup("");
  98.     acct->hookendd=strdup("");
  99.  
  100.     acct->usephrase=1;
  101.     acct->remphrase=1;
  102.     acct->passphrase=strdup("");
  103.     acct->signall=0;
  104.     acct->inclpub=0;
  105.     acct->inclprint=0;
  106.     acct->secwarn=1;
  107.  
  108.     return(acct);
  109. }
  110.  
  111. pMigAddr MigLibAllocAddr(void){
  112.     pMigAddr addr;
  113.  
  114.     addr=(pMigAddr)malloc(sizeof(MigAddr));
  115.  
  116.     addr->group=0;
  117.  
  118.     addr->EMail=strdup("");
  119.     addr->Alias=strdup("");
  120.     addr->Name=strdup("");
  121.  
  122.     addr->Company=strdup("");
  123.     addr->Title=strdup("");
  124.     addr->HStreet=strdup("");
  125.     addr->HCity=strdup("");
  126.     addr->HState=strdup("");
  127.     addr->HBuild=strdup("");
  128.     addr->HPC=strdup("");
  129.     addr->HCountry=strdup("");
  130.     addr->HPhone=strdup("");
  131.     addr->HExt=strdup("");
  132.     addr->HFAX=strdup("");
  133.     addr->BStreet=strdup("");
  134.     addr->BCity=strdup("");
  135.     addr->BState=strdup("");
  136.     addr->BBuild=strdup("");
  137.     addr->BPC=strdup("");
  138.     addr->BCountry=strdup("");
  139.     addr->BPhone=strdup("");
  140.     addr->BExt=strdup("");
  141.     addr->BFAX=strdup("");
  142.  
  143.     addr->Notes=strdup("");
  144.     addr->File=strdup("");
  145.     addr->inpopup=1;
  146.  
  147.     return(addr);
  148. }
  149.  
  150. //-----------------------------------------------------------------------------
  151. //  The following code should be modified as required to perform migration
  152. //  
  153. //  Migration Code...
  154. //-----------------------------------------------------------------------------
  155.  
  156. //-----------------------------------------------------------------------------
  157. // MigLibGetName
  158. //  
  159. // This function returns the generic name of the product that this library
  160. // migrates.  You *must* return a strdup()'ed string so that the memory is 
  161. // global to the process.
  162. //
  163. // This string is used in the detection process to inform the user which
  164. // library is active.
  165. //
  166. //-----------------------------------------------------------------------------
  167.  
  168. char *MigLibGetName(void){
  169.     //TODO:  change the product name below
  170.     char productname[]="Migration Stub Driver";
  171.  
  172.     return(strdup(productname));
  173. }
  174.  
  175. //-----------------------------------------------------------------------------
  176. // MigLibGetInfo
  177. //
  178. // This function takes two double pointers.  They are pointers to the first
  179. // and last members of a linked list of Migration Information structures.
  180. // These structures should be allocated and filled in.  A description of each
  181. // member can be found in the migobj.h file.
  182. //
  183. // If your library can migrate more than one mailer, typically this function
  184. // will malloc more than one MigInfo structure.  If, however, the library
  185. // only migrates one mailer, only one MigInfo structure would be allocated
  186. // and ppmifirst and ppmilast would both point to that single struct.
  187. //
  188. // This function returns an int indicating success.  Return 1==success,
  189. // 0==failure.
  190. //
  191. //-----------------------------------------------------------------------------
  192.  
  193. int MigLibGetInfo(pMigInfo *ppmifirst, pMigInfo *ppmilast){
  194.     pMigInfo cur=0L, prev=0L;
  195.     char temp[512];
  196.     int i;
  197.  
  198.     for(i=0;i<4;i++){
  199.         cur=(pMigInfo)malloc(sizeof(MigInfo));
  200.  
  201.         cur->libname=strdup("PMMSTUB.MIG");
  202.  
  203.         cur->available=TRUE;
  204.         cur->mig=TRUE;
  205.         sprintf(temp, "Stub v%d.0", i+1);
  206.         cur->product=strdup(temp);
  207.         sprintf(temp, "C:\\Program Files\\Stub%d", i+1);
  208.         cur->path=strdup(temp);
  209.         cur->infofound=MIG_ACCT|MIG_FOLD|MIG_MSGS|MIG_ADDR;
  210.         cur->infomig=MIG_ACCT|MIG_FOLD|MIG_MSGS;
  211.         cur->userdata=0L;
  212.  
  213.         cur->author=strdup("Blueprint Software Works, Inc.");
  214.         cur->copyright=strdup("Copyright 2000, Blueprint Software Works, Inc.");
  215.         cur->comment=strdup("Migration Stub Driver");
  216.  
  217.         cur->next=0L;
  218.  
  219.         if(prev) prev->next=cur;
  220.         else *ppmifirst=cur;
  221.         prev=cur;
  222.     }
  223.  
  224.     *ppmilast=cur;
  225.  
  226.     return(1);
  227. }
  228.  
  229. //-----------------------------------------------------------------------------
  230. // MigLibMigrateAcct
  231. //
  232. // This function takes two arguments:
  233. //
  234. //        pMigInfo pmi:    The MigInfo structure that is currently being
  235. //                        migrated.  The data fields in this structure can
  236. //                        be used for reference purposes.
  237. //
  238. // The second is a pointer to a function that is used for creating accounts.
  239. // The prototype for this function is:
  240. //
  241. //        void *MigrateCreateAcct(pMigAcct data);
  242. //
  243. // In this function, one would allocate a MigAcct structure by calling
  244. // MigLibAllocAcct.  You *must* call MigLibAllocAcct to insure proper
  245. // default values are put in place.  You then set any fields within the
  246. // MigAcct structure that are pertinant and available from the mailer
  247. // You are migrating.  Then, call MigrateCreateAcct and store the return
  248. // value from this function.  Descriptions of the members of MigAcct can
  249. // be found in migobj.h
  250. //
  251. // This function returns a void pointer.  The return value should be the
  252. // return value from calling MigrateCreateAcct(data);
  253. //
  254. //-----------------------------------------------------------------------------
  255.  
  256. void *MigLibMigrateAcct(pMigInfo pmi, PFNCREATEACCT MigrateCreateAcct){
  257.     pMigAcct acct=0L;
  258.     void *retval;
  259.  
  260.     acct=MigLibAllocAcct();
  261.  
  262.     acct->acctname=strdup(pmi->product);
  263.     acct->fromreal=strdup("Stub Test User");
  264.     acct->fromemail=strdup("test@test.com");
  265.     acct->replyreal=strdup("Stub Test User");
  266.     acct->replyemail=strdup("test@test.com");
  267.  
  268.     retval=MigrateCreateAcct(acct);
  269.  
  270.     return(retval);
  271. }
  272.  
  273. //-----------------------------------------------------------------------------
  274. // MigLibMigrateFoldsAndMsgs
  275. //
  276. // This function takes many arguments:
  277. //
  278. //        pMigInfo pmi:    The MigInfo structure that is currently being
  279. //                        migrated.  The data fields in this structure can
  280. //                        be used for reference purposes.
  281. //
  282. //        void *acct:        This is the account that the folders and messages
  283. //                        are being migrated into.  Several of the functions
  284. //                        you will need to call will need this pointer.
  285. //
  286. //        BOOL fold:        This tells you whether or not the user has chosen to
  287. //                        migrate folders.
  288. //
  289. //        BOOL msg:        This tells you whether or not the user has chosen to
  290. //                        migrate messages.
  291. //
  292. // The next four arguments are function to control folders and messages.
  293. // Their prototypes are:
  294. //
  295. //        int MigrateCreateFold(void *acct, int parentid, char *name, int sortord,
  296. //                                int sorttype[10], int indunread, int indany);
  297. //
  298. //                acct:        acct in which to create folder
  299. //                id:            id of folder's parent (-1==create at root;any other
  300. //                            value denotes the id of a parent folder)
  301. //                sortord:    the sort order of the address book
  302. //                            (0==ascending;1==descending)
  303. //                sorttype:    an array defining the sort priority for this folder.
  304. //                            The first position in the array defines which criterion
  305. //                            is sorted on first.  If that matches, the second is 
  306. //                            used, and so on.
  307. //
  308. //                            0==Read Status
  309. //                            1==Attachments
  310. //                            2==Date & Time Of Message
  311. //                            3==Date & Time Received
  312. //                            4==Subject
  313. //                            5==From E-Mail Address
  314. //                            6==From Real Name
  315. //                            7==To E-Mail Address
  316. //                            8==To Real Name
  317. //                            9==Size
  318. //
  319. //                indunread:    0==The folder should *not* indicate unread messages
  320. //                            1==The folder should indicate unread messages
  321. //
  322. //                indany:        0==The folder should *not* indicate the presence of messages
  323. //                            1==The folder should indicate the presence of messages
  324. //
  325. //        char *MigrateGetFoldPath(void *acct, int id);
  326. //
  327. //                acct:        acct containing folder
  328. //                id:            id of folder
  329. //
  330. //        int MigrateAddMessageToFold(void *acct, int msgstat, char *filename);
  331. //
  332. //                acct:        acct containing folder
  333. //                msgstat:    status to assign to the new message
  334. //
  335. //                            0==read
  336. //                            1==new
  337. //                            2==replied or forwarded
  338. //                            3==sent or waiting to be sent
  339. //
  340. //                filename:    the name of the file to be indexed
  341. //
  342. //        int MigrateSaveFold(void *acct, int id);
  343. //
  344. //                acct:        acct containing folder
  345. //                id:            id of folder
  346. //
  347. // For all the functions which take a folder id, you may use FOLD_INBOX,
  348. // FOLD_OUTBOX, FOLD_SENT, and FOLD_TRASH to place messages or folders
  349. // within the inbox, outbox, sent mail, and trash folders, respectively.
  350. //
  351. // In this function, you would create folders as the user desires in the
  352. // acct that is passed in.  To do this, one would call MigrateCreateFold.
  353. // Then, you must copy the messages to be inserted, one by one into the
  354. // folder.  To get the hard drive path for a folder, call MigrateGetFoldPath.
  355. // After each file has been copied, you must call MigrateAddMsgToFold. Then,
  356. // after each folder is migrated, call MigrateSaveFold to write the message
  357. // index to the disk.
  358. //
  359. // This function does not return a value.
  360. //
  361. //-----------------------------------------------------------------------------
  362.  
  363. void MigLibMigrateFoldsAndMsgs(pMigInfo pmi, void *acct, BOOL fold, BOOL msg, PFNCREATEFOLD MigrateCreateFold, PFNGETFOLDPATH MigrateGetFoldPath, PFNADDTOFOLD MigrateAddMessageToFold, PFNSAVEFOLD MigrateSaveFold){
  364.     int ord[10], i, id;
  365.  
  366.     for(i=0;i<10;i++) ord[i]=i;
  367.     id=MigrateCreateFold(acct, -1, "Stub Messages", 1, ord, 1, 1);
  368.     MigrateCreateFold(acct, id, "Stub Messages 2", 1, ord, 1, 1);
  369. }
  370.  
  371. //-----------------------------------------------------------------------------
  372. // MigLibMigrateFoldsAndMsgs
  373. //
  374. // This function takes three arguments:
  375. //
  376. //        pMigInfo pmi:    The MigInfo structure that is currently being
  377. //                        migrated.  The data fields in this structure can
  378. //                        be used for reference purposes.
  379. //
  380. //
  381. // The next two arguments are function to control folders and messages.
  382. // Their prototypes are:
  383. //
  384. //        int MigrateCreateAddressBook(char *name, int sortord, int sorttype);
  385. //
  386. //            name:        the name of the address book
  387. //            sortord:    the sort order of the address book
  388. //                        (0==ascending;1==descending)
  389. //            sorttype:    the sort type of the address book
  390. //                        (0==alias;1==email address;2==real name;3==phone #)
  391. //
  392. //        int MigrateAddAddress(int id, pMigAddr data);
  393. //
  394. // In this function, you would create address books.  To do this, one would 
  395. // call MigrateCreateAddressBook. This function returns an address book id.
  396. // Then, you can call MigrateAddAddress using an addres book id.  When creating
  397. // the MigAddr structure used by MigrateAddAddress, you *must* call MigLibAllocAddr.
  398. // That function sets up certain defaults.  You set the values which are available,
  399. // and pass that struct into MigrateAddAddress.  The members of MigAddr are
  400. // defined in migobj.h
  401. //
  402. // This function does not return a value.
  403. //
  404. //-----------------------------------------------------------------------------
  405.  
  406. void MigLibMigrateAddrData(pMigInfo pmi, PFNADDRBOOK MigrateCreateAddressBook, PFNADDTOBOOK MigrateAddAddress){
  407.     pMigAddr addr;
  408.     int id;
  409.  
  410.     id=MigrateCreateAddressBook("Test", 1, 1);
  411.  
  412.     addr=MigLibAllocAddr();
  413.     addr->Alias="Test";
  414.     addr->Name="Test";
  415.     addr->EMail="Test";
  416.     MigrateAddAddress(id, addr);
  417. }
  418.  
  419. //-----------------------------------------------------------------------------
  420. // MigManualInfo
  421. //
  422. // This function takes three arguments:
  423. //
  424. //        pMigInfo pmi:    The MigInfo structure that is currently being
  425. //                        migrated.  The data fields in this structure can
  426. //                        be used for reference purposes.
  427. //
  428. //
  429. // This function is called when the user uses the "Add Mailer" button.
  430. // You can use it to prompt the user for information when they want to
  431. // manually migrate a mailer.  A mailer would be manually migrated if
  432. // there is no way to determine its presence or location.
  433. //
  434. // Return TRUE if the information was gathered properly or FALSE if it
  435. // was not.
  436. //
  437. //-----------------------------------------------------------------------------
  438.  
  439. BOOL MigManualInfo(pMigInfo pmi){
  440.     return(TRUE);
  441. }
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.